Skip to content

Include dpctl4pybind11.hpp in dpnp4pybind11.hpp and switch libtensor to dpnp namespace#2862

Merged
antonwolfy merged 10 commits intoinclude-dpctl-tensorfrom
further-refactor-dpnp4pybind11
Apr 20, 2026
Merged

Include dpctl4pybind11.hpp in dpnp4pybind11.hpp and switch libtensor to dpnp namespace#2862
antonwolfy merged 10 commits intoinclude-dpctl-tensorfrom
further-refactor-dpnp4pybind11

Conversation

@ndgrigorian
Copy link
Copy Markdown
Collaborator

@ndgrigorian ndgrigorian commented Apr 19, 2026

This PR proposes including dpctl4pybind11.hpp in dpnp4pybind11.hpp.

  • dpnp4pybind11 reimplemented most of the logic from dpctl4pybind11 unnecessarily, including SYCL casters, which should not be the responsibility of dpnp to implement, and management of memory objects, also not dpnp's responsibility
  • As dpnp4pybind11.hpp is still using the dpctl namespace, the reimplementations could potentially cause code using both dpctl4pybind11.hpp and dpnp4pybind11.hpp together to crash due to multiple definitions in one translation unit. This can be problematic when both libraries are attempting to expose headers, with dpnp depending directly on dpctl

As part of this change, this PR also changes the dpctl namespace in libtensor to dpnp

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

include dpctl4pybind11.hpp and remove redundant code
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

View rendered docs @ https://intelpython.github.io/dpnp/index.html

@ndgrigorian ndgrigorian changed the title Include dpctl4pybind11.hpp in dpnp4pybind11.hpp Include dpctl4pybind11.hpp in dpnp4pybind11.hpp and switch libtensor to dpnp namespace Apr 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

Array API standard conformance tests for dpnp=0.20.0dev6=py313h509198e_69 ran successfully.
Passed: 1355
Failed: 5
Skipped: 16

array unused, stddef.h not used because size_t is never used with C linkage
@ndgrigorian ndgrigorian force-pushed the further-refactor-dpnp4pybind11 branch from 7d4b95f to ffa9268 Compare April 19, 2026 23:59
@ndgrigorian
Copy link
Copy Markdown
Collaborator Author

ndgrigorian commented Apr 20, 2026

This PR can be split to implement the namespace changes in a follow-up, only the first 3 commits (and the part about adding back keep_args_alive) need to be part of this PR in theory, though includes with dpctl4pybind11 could break

but regardless, it should go in before migration is complete @antonwolfy @vlad-perevezentsev

test slowdown was likely caused by their removal
also add a TODO for reusing a future, more general keep_args_alive from dpctl
Comment thread dpnp/backend/include/dpnp4pybind11.hpp
Comment thread dpnp/backend/extensions/blas/dot_common.hpp
Comment thread dpnp/backend/include/dpnp4pybind11.hpp Outdated
Comment thread dpnp/backend/include/dpnp4pybind11.hpp Outdated
Comment thread dpnp/backend/include/dpnp4pybind11.hpp Outdated
@ndgrigorian ndgrigorian requested a review from antonwolfy April 20, 2026 15:30
Copy link
Copy Markdown
Contributor

@antonwolfy antonwolfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @ndgrigorian , no more comments from me

@antonwolfy
Copy link
Copy Markdown
Contributor

The CI failures seems unrelating, so merging

@antonwolfy antonwolfy merged commit 0531fe1 into include-dpctl-tensor Apr 20, 2026
67 of 72 checks passed
@antonwolfy antonwolfy deleted the further-refactor-dpnp4pybind11 branch April 20, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants